package com.walter.weixin.bridge.schedules;

import com.walter.redis.tools.DistributedLockService;
import com.walter.redis.tools.RedisUtil;
import com.walter.redis.tools.annotation.RedisLock;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author Walter
 * @date 2025/1/20 下午2:55
 **/
@Component
@Slf4j
public class MySchedule {
    @Resource
    private DistributedLockService distributedLockService;
    @Scheduled(cron = "0 0/1 * * * *")
    @RedisLock
    public void test() {
        RedisUtil.set("test", "test001",20);
        log.info("test MySchedule,{}",RedisUtil.get("test"));
//        distributedLockService.tryLock("test", "test", 10);
    }
}
